﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CoderJoe
{
    public static class ObjectFactory
    {
        public static TInterface CreateInstance<TInterface>(TInterface instance, AspectCategory category)
        {
            AspectContainer container = new AspectContainer(category);
            container.FindAspects(instance);

            Type type = FindCachedType(typeof(TInterface));
            if(type == null)
            {
                type = CreateType(typeof(TInterface));
                CacheType(typeof(TInterface), type);
            }

            return (TInterface)Activator.CreateInstance(type, instance, container);
        }

        private static Type FindCachedType(Type interfaceType)
        {
            return null;
        }

        private static Type CreateType(Type interfaceType)
        {
            return null;
        }

        private static void CacheType(Type interfaceType, Type implementationType)
        {
        }
    }
}
